<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ include file="../../../views/include/taglib.jsp"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>新增服务项目</title>
<head>
    <meta charset="utf-8">
    <title>新增服务项目</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">

    <link rel="stylesheet" href="/fdoctor-ms/statics/beginnerAdmin/plugins/layui/css/layui.css" media="all" />
    <link rel="stylesheet" href="/fdoctor-ms/statics/beginnerAdmin/plugins/font-awesome/css/font-awesome.min.css">
    <link rel="stylesheet" href="/fdoctor-ms/statics/beginnerAdmin/css/btable.css" />
    
    <script type="text/javascript" src="/fdoctor-ms/statics/beginnerAdmin/plugins/layui/layui.js"></script>
    <script type="text/javascript" src="/fdoctor-ms/statics/js/jquery-2.1.4.min.js"></script>
    <script type="text/javascript" src="/fdoctor-ms/statics/js/inputTools.js"></script>
    
</head>

<body>
	<fieldset class="layui-elem-field layui-field-title" style="margin-top: 5px;margin-left: 5px;margin-right: 5px">
	  <legend>新增服务项目
	  </legend>
	</fieldset>
	<form class="layui-form" action="" id="dataForm">
	<input type=hidden name="updateMan" id="updateMan" value="${sessionScope.user_in_session.userName}"/>
		<div class="layui-form-item" style="width: 90%">
			<label class="layui-form-label"  >服务项目名称：</label>
			<div class="layui-input-block" >
		      <input type="text" class="layui-input" name="serviceName" id="serviceName" value=""/>
			</select>  
		    </div>
		</div>
		
		<div class="layui-form-item" style="width: 90%">
			<label class="layui-form-label">服务频率：</label>
			<div class="layui-input-block">
		     	<select name="frequency" id="frequency" layer-filter="frequency">'
					<option value="-1" selected="true">总是</option>
					<option value="1">1次/年</option>
					<option value="2">2次/年</option>
					<option value="4">4次/年</option>
					<option value="6">6次/年</option>
					<option value="12">12次/年</option>
					<option value="24">24次/年</option>
				</select>
		    </div>
		</div>  
		<div class="layui-form-item" style="width: 90%">
			<label class="layui-form-label" > 服务类型：</label>
			<div class="layui-input-block">
				<select name="serviceType" id="serviceType" layer-filter="serviceType">
					<option value="1" selected="true">基础服务</option>
					<option value="2">增值服务</option>
				</select> 
			</div>
		</div>
		
		<div class="layui-form-item" style="width: 90%">
			<label class="layui-form-label">服务项目描述：</label>
			<div class="layui-input-block">
		      <textarea type="" class="layui-textarea" name="serviceDetails" id="serviceDetails" ></textarea>
		    </div>
		</div>
		
		<hr>
	  <div align="center">
	  		<button class="layui-btn layui-btn-big layui-btn-primary layui-btn-radius" type="button" id="saveButton"><i class="layui-icon">&#xe618;</i>确认保存</button>
	  </div>
	</form>
	  
</body>

<script type="text/javascript">
	//初始化表单控件
layui.use(['jquery', 'form','laydate'], function() {
	$ = layui.jquery;
	form = layui.form();
	var laydate = layui.laydate;
	
    
    $('#saveButton').on('click',function(){
    	if($('#serviceName').val() == ''){
    		layer.msg('请输入服务项目名称！',{icon: 7});
    		return;
    	}
    	
    	layer.confirm('确认保存？', {icon: 3, title:'提示'}, function(index){
			layer.close(index);
			$.ajax({
				type : 'POST',
				url : '/fdoctor-ms/servicePack/addDetailNew',
				data : packParams(),
				success : function(data) {
					if (data.code == 200) {
						var index = parent.layer.getFrameIndex(window.name);
						parent.layer.close(index);
						parent.layer.msg('保存成功！', {
							icon : 1
						});
						parent.tableConfig();
					} else {
						parent.layer.msg('保存失败！', {
							icon : 2
						});
					}
				}
			});
		});
    });
    
    function packParams(){
    	var param = {
    			serviceName:  $('#serviceName').val(),
				updateMan : $('#updateMan').val(),
				frequency : $('#frequency').val(),
				serviceType : $('#serviceType').val(),
				serviceDetails : document.getElementById('serviceDetails').value
		}
		return param;
	}
    
   
})
</script>
</html>